package com.jxw.engine.platsign;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Looper;
import com.jxw.engine.platsign.DialogNetWraning;
import com.jxw.launcher.R;
import com.jxw.studyrecord.StudyRecordAPKInfo;

/* loaded from: classes.dex */
public class WIFI_Listener implements DialogInterface.OnClickListener {
    Activity context;
    private final int REQUEST = 5;
    private final String PACKAGE = StudyRecordAPKInfo.PACKAGE_SYSTEM_SETTING;
    private final String NAME_XHDPI = ".Settings$WifiSettingsActivity";
    private final String NAME_DEFULT = ".WirelessSettings";

    public WIFI_Listener(Activity activity) {
        this.context = null;
        this.context = activity;
    }

    @Override // android.content.DialogInterface.OnClickListener
    public void onClick(DialogInterface dialogInterface, int i) {
        dialogInterface.cancel();
        if (i == -1) {
            Intent intent = new Intent();
            intent.setClassName(StudyRecordAPKInfo.PACKAGE_SYSTEM_SETTING, "com.android.settings.Settings$WifiSettingsActivity");
            try {
                ((MainActivity) this.context).startActivityForResult(intent, 5);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    /* renamed from: com.jxw.engine.platsign.WIFI_Listener$1  reason: invalid class name */
    /* loaded from: classes.dex */
    class AnonymousClass1 implements DialogNetWraning.OnConfirmClickListener {
        AnonymousClass1() {
        }

        @Override // com.jxw.engine.platsign.DialogNetWraning.OnConfirmClickListener
        public void onClick() {
            WIFI_Listener.this.context.startActivity(new Intent("android.settings.WIFI_SETTINGS"));
            WIFI_Listener.this.context.finish();
        }
    }

    private void show() {
        Resources resources = this.context.getResources();
        new AlertDialog.Builder(this.context).setTitle(resources.getString(R.string.notify)).setMessage(resources.getString(R.string.to_setting)).setPositiveButton(resources.getString(R.string.wifi_set), new DialogInterface.OnClickListener() { // from class: com.jxw.engine.platsign.WIFI_Listener.4
            @Override // android.content.DialogInterface.OnClickListener
            public void onClick(DialogInterface dialogInterface, int i) {
                WIFI_Listener.this.context.startActivity(new Intent("android.settings.WIFI_SETTINGS"));
                WIFI_Listener.this.context.finish();
            }
        }).setOnDismissListener(new DialogInterface.OnDismissListener() { // from class: com.jxw.engine.platsign.WIFI_Listener.3
            @Override // android.content.DialogInterface.OnDismissListener
            public void onDismiss(DialogInterface dialogInterface) {
                WIFI_Listener.this.context.finish();
            }
        }).setNegativeButton(resources.getString(R.string.wifi_exit), new DialogInterface.OnClickListener() { // from class: com.jxw.engine.platsign.WIFI_Listener.2
            @Override // android.content.DialogInterface.OnClickListener
            public void onClick(DialogInterface dialogInterface, int i) {
                WIFI_Listener.this.context.finish();
            }
        }).show();
    }

    public void showAlertDialog() {
        try {
            Looper.prepare();
            show();
            Looper.loop();
        } catch (Exception e) {
            e.printStackTrace();
            show();
        }
    }
}
